﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
			 mc:Ignorable="d"
			 x:Class="Sentinel.Controls.ImageTypesControl"
			 x:Name="UserControl"
			 d:DesignWidth="445.9"
			 d:DesignHeight="80.88">

	<UserControl.Resources>
		<Style TargetType="{x:Type ListView}"
			   BasedOn="{StaticResource {x:Type ListBox}}">
			<Setter Property="BorderBrush"
					Value="Black" />
			<Setter Property="BorderThickness"
					Value="0.5" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate>
						<Border Name="bd"
								BorderBrush="{TemplateBinding BorderBrush}"
								BorderThickness="{TemplateBinding BorderThickness}"
								Background="{TemplateBinding Background}"
								Margin="{TemplateBinding Margin}">
							<ScrollViewer Margin="{TemplateBinding Padding}">
								<WrapPanel ItemWidth="100"
										   IsItemsHost="True"
										   MinWidth="100"
										   Width="{Binding ActualWidth,RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}">
								</WrapPanel>
							</ScrollViewer>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style TargetType='{x:Type ListViewItem}'
			   BasedOn='{StaticResource {x:Type ListBoxItem}}'>
			<Setter Property='Padding'
					Value='3' />
			<Setter Property='Margin'
					Value='5' />
			<Setter Property='HorizontalContentAlignment'
					Value='Center' />
			<Setter Property="ContentTemplate">
				<Setter.Value>
					<DataTemplate>
						<StackPanel Orientation="Vertical">
							<Image Margin="3"
								   Width="16"
								   Height="16"
								   VerticalAlignment="Center"
								   HorizontalAlignment="Center"
								   Source="{Binding Image}" />
							<Label Content="{Binding Name}"
								   VerticalAlignment="Center"
								   HorizontalAlignment="Center" />
							<Label Content="{Binding Quality}"
								   FontSize="10"
								   VerticalAlignment="Center"
								   HorizontalAlignment="Center" />
						</StackPanel>
					</DataTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</UserControl.Resources>

	<Grid x:Name="LayoutRoot">
		<Grid d:LayoutOverrides="Height">
			<Grid.ColumnDefinitions>
				<ColumnDefinition />
				<ColumnDefinition Width="80" />
			</Grid.ColumnDefinitions>
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
				<RowDefinition Height="*" />
			</Grid.RowDefinitions>

			<ListView Grid.RowSpan="4"
					  ItemsSource="{Binding Images.ImageMappings}"
					  SelectedIndex="{Binding Images.SelectedIndex}"					  
					  SelectionMode="Single">
			</ListView>

			<Button Grid.Column="1"
					Content="_Add"
					Command="{Binding Images.Add}"
					Margin="5,0,5,5" />
			<Button Grid.Column="1"
					Command="{Binding Images.Edit}"
					Grid.Row="1"
					Content="_Edit"
					Margin="5,0,5,5" />
			<Button Grid.Column="1"
					Grid.Row="2"
					Command="{Binding Images.Remove}"
					Content="_Remove"
					Margin="5,0,5,5" />
		</Grid>
	</Grid>
</UserControl>